//
//  SecondViewController.swift
//  DateUsage
//
//  Created by YJH on 2025/5/24.
//

import UIKit

class SecondViewController: UIViewController {
    
    var ff: Foo?
    
    deinit {
        print("deinit \(self)")
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        view.backgroundColor = .white
        
        let a = Foo()
        
        let f = Foo()
        f.action = { [weak self] in
            self?.boo()
        }
        ff = f
        f.action?()
    }
    
    func boo() {
        print("ok")
    }
    
}

class Foo {
    
    var handler: (() -> Void)?
    var action: (() -> Void)?
    
    deinit {
        print("deinit \(self)")
    }
    
    
    
}
